#include "Yield.h"
#include "IVisitor.h"

Yield::Yield(const exprTypePtr& value, int nodeId):
    exprType(nodeId),
    _value(value)
{
}
    
Yield::~Yield()
{
    
}
    
QString Yield::type() const
{
    return "Yield";
}
    

exprTypePtr Yield::value()
{
    return _value;
}

void Yield::setValue(const exprTypePtr& value)
{
    _value = value;
}

    
QString Yield::toString() const
{
    return QString("Yield[value=%1]").
                arg(_value ? _value->toString():"");
}
    
void Yield::accept(IVisitor* visitor, const SimpleNodePtr& node)
{
    visitor->visitYield(node.dynamicCast<Yield>());
}
    
void Yield::traverse(IVisitor* visitor)
{
    if (_value != NULL)
        _value->accept(visitor, _value);
}